package com.atguigu.gmall.juc.atomic;

import jdk.nashorn.internal.objects.annotations.Getter;

/**
 * @author 陈昆昆
 * @version 1.0
 * @date 2020/6/2 17:50
 */
public enum Code {
    ONE(1, "A"),TWO(2,"B"),three(3,"C"),four(4,"D"),five(5,"E"),six(6,"F");
    private Integer code;
    private String message;
    public void setCode(int code) {
        this.code = code;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
    Code(Integer code,String message){
        this.code=code;
        this.message=message;
    }

    public static Code index(int index) {
        Code[] values = Code.values();
        for (Code code:values) {
            if (index==code.getCode()){
                return code;
            }
        }
        return null;
    }

}

